//
//  ComposeViewController.h
//  SinaWeiboOAuthDemo
//
//  Created by junmin liu on 11-1-4.
//  Copyright 2011 Openlab. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "Draft.h"
#import "WeiboClient.h"
#import "OAuthEngine.h"
#import "Utility.h"
#import "Reachability.h"

@class ComposeViewController;

@interface ImagePickerController : UIImagePickerController
{
	IBOutlet ComposeViewController* weiBoEditor;
}
@end


@interface ComposeViewController : UIViewController <UINavigationControllerDelegate,
													UIActionSheetDelegate,
													UIImagePickerControllerDelegate>{
	UIBarButtonItem *btnSend;
	UIBarButtonItem *btnCancel;
	UIBarButtonItem *btnInsert;
	UITextView *messageTextField;
	UIView *sendingView;
	UIImageView *attachmentImage;
	Draft *draft;
	UIDatePicker *pickerView;
	UIActionSheet *progressSheet;
	NSURL*					pickedVideo;
	UIImage*				pickedPhoto;
	ImagePickerController   *imgPicker;
}

@property (nonatomic, retain) IBOutlet UITextView *messageTextField;
@property (nonatomic, retain) IBOutlet UIBarButtonItem *btnSend;
@property (nonatomic, retain) IBOutlet UIBarButtonItem *btnCancel;
@property (nonatomic, retain) IBOutlet UIBarButtonItem *btnInsert;
@property (nonatomic, retain) IBOutlet UIView *sendingView;
@property (nonatomic, retain) IBOutlet UIImageView *imgAttachment;
@property (nonatomic, retain) IBOutlet ImagePickerController *imgPicker;
@property (nonatomic, retain) UIActionSheet *progressSheet;
@property (nonatomic, retain) NSURL*		pickedVideo;
@property (nonatomic, retain) UIImage*		pickedPhoto;

- (void)newTweet;

- (IBAction)send:(id)sender;

- (IBAction)cancel:(id)sender;

- (IBAction)insert:(id)sender;

- (void)postNewStatus;

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editInfo;
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker;

- (NSArray*)availableMediaTypes:(UIImagePickerControllerSourceType) pickerSourceType;

- (BOOL)mediaIsPicked;
- (void)setImage:(UIImage*)img movie:(NSURL*)url;

- (void)startUploadingOfPickedMediaIfNeed;
- (void)startUpload;

- (void)SaveCurrentContent;

- (void)ResetSavedContent;

- (NSString *)LoadSavedContent;

@end
